package com.ethank.controller.wx;

import com.ethank.common.core.domain.AjaxResult;
import com.ethank.service.WxService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author tf
 * @date 2024-02-28
 * @Description
 */
@RequestMapping("/wx")
@RestController
public class WxController {

    @Autowired
    WxService wxService;

    /**
    * @Description: JsApi签名数据
    * @Param: [url]
    * @return: com.ethank.common.core.domain.AjaxResult
    * @Author: tf
    * @Date: 2024-02-28
    */
    @PostMapping("/getJsSign")
    public AjaxResult getJsSign(@RequestParam(name="url") String url,@RequestParam(value = "clientId",required = false,defaultValue = "jsapi_ticket") String clientId) throws Exception {
        return wxService.getJsSign(url,clientId);
    }


    /**
     * @Description: 获取用户信息
     * @Param: [url]
     * @return: com.ethank.common.core.domain.AjaxResult
     * @Author: tf
     * @Date: 2024-02-28
     */
    @PostMapping("/getUerInfo")
    public AjaxResult getUerInfo(String code)  {
        return wxService.getUserInfo(code);
    }
}
